﻿Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVTuyenDung

    Public MustInherit Class SpecialDefault2
        Inherits Entities.Modules.PortalModuleBase

#Region "Controls"
#End Region

#Region "Event Handlers"
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Not IsPostBack Then
                    Dim DisplayNumber As String
                    If Settings("NVNewsDisplayNumberSetting") <> "" Then
                        DisplayNumber = Settings("NVNewsDisplayNumberSetting")
                    Else
                        DisplayNumber = "1" ' 1 row and 1 col
                    End If
                    'Cac tin khac cung chuyen muc voi tin nay
                    Dim arrNews As New ArrayList
                    Dim ctlNews As New NVTuyenDung_TuyenDungController
                    arrNews = ctlNews.NV_TuyenDung_TuyenDung_SelectCustome2(IIf(Settings("NVNewsCongtySetting") <> "", Settings("NVNewsCongtySetting"), -1), IIf(Settings("NVNewsVitriSetting") <> "", Settings("NVNewsVitriSetting"), -1), PortalId, CInt(DisplayNumber) + 1)
                    Me.drgOtherNews.DataSource = arrNews
                    Me.drgOtherNews.DataBind()
                End If
            Catch ex As Exception
                'Me.imgNews.Visible = False
                ' Exception
                ProcessModuleLoadException(Me, ex)
            End Try
        End Sub
        Public Function ReplaceChuoi(ByVal chuoi As String) As String
            Dim convert As String = Global.ReplaceChuoi.bodau(chuoi).Replace(" ", "-")
            Return convert
        End Function
        Public Function FormatURL(ByVal strCongty As String, ByVal strVitri As String, ByVal strID As String, ByVal strLink As String) As String
            Return "/tabid/" & Settings("NVTuyenDungDisplayPageSetting") & "/congty/" & strCongty & "/vitri/" & strVitri & "/tuyendung/" & strID & "/" & ReplaceChuoi(strLink) & ".htm"
        End Function
        Function GetCongtyName(ByVal id As String) As String
            Dim ctlCongTy As New NVTuyenDung_CongtyController
            Dim objCongTy As NVTuyenDung_CongtyInfo
            objCongTy = ctlCongTy.NV_TuyenDung_Cty_GetByID(id, PortalId)
            Return objCongTy.Tencongty()
        End Function
        Public Function GetVitriName(ByVal Id As String) As String
            Dim ctlCauthu As New NVTuyenDung_VitriController
            Dim objCauthu As NVTuyenDung_VitriInfo
            objCauthu = ctlCauthu.NVTuyenDung_Vitri_GetByID(Id)
            Return objCauthu.VitriTuyenDung
        End Function
        Function CheckDate(ByVal Id As String) As String
            Dim ctlCauthu As New NVTuyenDung_TuyenDungController
            Dim objCauthu As NVTuyenDung_TuyenDUngInfo
            objCauthu = ctlCauthu.NVTuyenDung_TuyenDung_GetByID(Id, PortalId)
            If objCauthu.NgayHetHan < Date.Now Then
                Return "TIN HẾT HẠN"
            End If
            Return "Ngày hết hạn: " & objCauthu.NgayHetHan
        End Function

#End Region

#Region "Optional Interfaces"

#End Region


    End Class

End Namespace
